package com.weitu.permission.district.service.impl;

import com.weitu.permission.district.entity.City;
import com.weitu.permission.district.mapper.CityMapper;
import com.weitu.permission.district.service.CityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CityServiceImpl implements CityService {
    private final CityMapper cityMapper;

    private static final Logger logger = LoggerFactory.getLogger(CityServiceImpl.class);

    @Autowired
    public CityServiceImpl(CityMapper cityMapper) {
        this.cityMapper = cityMapper;
    }

    @Override
    public City selectByPrimaryKey(String code) {
        return this.cityMapper.selectByPrimaryKey(code);
    }

    @Override
    @Transactional
    public int deleteByPrimaryKey(String code) {
        return this.cityMapper.deleteByPrimaryKey(code);
    }

    @Override
    @Transactional
    public int updateByPrimaryKeySelective(City record) {
        return this.cityMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    @Transactional
    public int insertSelective(City record) {
        return this.cityMapper.insertSelective(record);
    }

    @Override
    public List<City> queryList(String parentCode, String code) {
        return this.cityMapper.queryList(parentCode,code);
    }
}